package di;

import di.bean.Dog;
import di.bean.Student;
import di.bean.Zoo;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class diApp {
    public static void main(String[] args) {
        // di();
        // diArgs();
        zoo();
    }

    private static void zoo() {
        final ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("di\\xml\\beans.xml");
        final Zoo zoo = (Zoo) context.getBean("zoo");
        System.out.println("zoo = " + zoo);
    }

    private static void diArgs() {
        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("di\\xml\\beans.xml");
        final Dog dog = (Dog) context.getBean("dog");
        System.out.println(dog.getName());
    }

    private static void di() {
        final ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("di\\xml\\beans.xml");
        final Student myStudent = (Student) context.getBean("myStudent4");
        myStudent.getTeacher();
    }
}
